今天把交易跟退款的代碼訊息寫出來,接著回頭看一下哪邊需要調整
static function pay_message($code): string
{
$code_map = [
'1A200' => '待付款',
'1A250' => '帳號逾期',
'1A400' => '付款完成',
'1A900' => '已撥款',
'1C200' => '待付款',
'1C250' => '刷卡逾期',
'1C300' => '已授權未請款',
'1C350' => '授權失效',
'1C351' => '取消授權',
'1C400' => '請款完成',
'1C900' => '已撥款',
'1F200' => '待付款',
'1F250' => '訂單逾期',
'1F350' => '訂單異常',
'1F400' => '付款完成',
'1F900' => '已撥款',
'1M200' => '待付款',
'1M250' => '訂單逾期',
'1M400' => '付款完成',
'1M900' => '已撥款',
];
return $code_map[$code];
}
static function refund_message($code): string
{
$code_map = [
'2C200' => '退款已受理',
'2C400' => '退款處理中',
'2C900' => '退款完成',
'2F290' => '扣款已退',
'2F300' => '已扣款',
'2F900' => '已賠償',
'2M200' => '退款已受理',
'2M400' => '退款處理中',
'2M900' => '退款完成',
];
return $code_map[$code];
}
接著新增一個函數
// app/Http/Controllers/Controller.php
public function description_process($message): array
{
$description = explode(' – ', $message['Description']);
return [
'status' => $description[0],
'description' => $description[1],
];
}
然後修改幾個地方
track_order
create_order
receive_msg
坐在電腦前發呆了好一陣子,發現要調整的東西太多了,好像要存的欄位有缺
於是我懶了,簡單解就好(X
laravel 的部分只到後天,明天把建立訂單的畫面簡單寫出來